<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script>
			window.onload = function()
			{
				let val = prompt('输入考试科目数量');
				let ret = 0;
				
				for(let i = 0; i < val; i++)
				{
					// let value = prompt('请输入第' + (i + 1) + '门的考试成绩');
					let value = prompt(`请输入第${i+1}门的考试成绩`);
					ret += parseFloat(value);
				}
				alert(`${val}门功课的总成绩为${ret}`);
			}
		</script>
	</head>
	<body>
		
	</body>
</html>